package play.coroutine.basics

import kotlinx.coroutines.async
import kotlinx.coroutines.delay
import kotlinx.coroutines.runBlocking


fun testAsyncAwait(){

}

fun main() {
    println("start...")

    runBlocking {
        println("blocking...")

        val a1 = async {
            println("start a1...")
            delay(1000)
        }
        val a2 = async {
            println("start a2...")
            delay(2000)
        }

        a1.start()
        a2.start()

        a1.await()
        println("a1 end...")
        a2.await()
        println("a2 end...")

        println("over...")

    }
}